<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="com.yaodian100.mall.member.util.UserData"%>
<%@page import="com.yaodian100.core.common.utils.ServerValue"%>
<%@page import="org.apache.commons.lang.StringUtils"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<%@taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt-rt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@taglib uri="/WEB-INF/tld/pageutil.tld" prefix="pu" %>
<%@taglib uri="/WEB-INF/tld/mallutil.tld" prefix="mu" %>
<%@page import="java.util.Date"%>
<%@page import="java.util.Calendar"%>
<%@page import="org.apache.commons.lang.time.DateUtils"%>
<link rel="stylesheet" href="/css/yaodian100_limitlist_v3.css" type="text/css" media="screen" />
<c-rt:set var="hostName" value='<%=request.getServerName()%>'/>
<c-rt:set var="frontendContextPath"><%=ServerValue.getFrontContextPath()%></c-rt:set>
<c-rt:set var="bfdCode" value='<%=ServerValue.getBfdCode()%>'/>
<c-rt:set var="useBfd" value='<%=ServerValue.getUseBfd()%>'/>
<c-rt:set var="ss" value='<%=System.currentTimeMillis()%>'/>
<%
	request.setAttribute("application", application);
%>
<style>
.promo-popup{padding:10px;*padding:10px 0 10px 8px; color:#666;line-height:1.4em; }
.promo-popup h2,.promo-popup h3{font-size:15px;color:#d12e6f; margin-bottom:.8em;}
.promo-popup h3{color:#666;}
.promo-popup p{margin:.5em 0;}
.promo-popup .d-line{background:url(/images/link_dote.gif) repeat-x scroll 0 50%; padding:1px 0;}
.promo-popup ol,.promo-popup ul{margin-bottom:1em;margin-left:2em;}
.promo-popup li{list-style:decimal;}
</style>

<script language="javascript">
<!--
var __msg = "";
<c-rt:if test="${!empty cartMessage}">__msg = "${cartMessage }";</c-rt:if>
	var hasTlProduct = "${not empty tlpList ? 'true' : 'false'}";
	$().ready(function(){
		if (__msg!="") 
			alert(__msg);
		//小手
		$(":input.txt-ss").mouseover(function(){
			$(this).css("cursor","pointer");
		});
		/*********************** init **********************/
		//載入n選m spec
		$("input[id*='editPickProdSpecName_']").each(function(){
			var pid = this.id.split("_")[1] + "_" + this.id.split("_")[2];
			var pitem=$(this).val().split(";")[0];
			var pvalue=$(this).val().split(";")[1];
			var pitemSize = pitem.indexOf(",") != -1 ? pitem.split(",") : pitem;
			var pvalueSize = pvalue.indexOf(",") != -1 ? pvalue.split(",") : pvalue;
			//庫存量(可售數)
			var pinventory = $("#productInventory_"+pid).val();
			var pinventorySize = pinventory.indexOf(",") != -1 ? pinventory.split(",") : pinventory;
			var dbSpec = 0;
			var inventoryText = "-已售完";
			var itemMin=$('#editMainMinCount_'+pid).attr('value');
			itemMin=parseInt(itemMin);
			//找出第n個數量>0的，就check spec
			var ckQty=	$("#editPickQty_"+pid).val();
			if ( ckQty.indexOf(",") != -1 ){
				ckQty = ckQty.split(",");
				for(kQty = 0; kQty < ckQty.length; kQty++){
					if ( parseInt(ckQty[kQty],10) > 0 )
						dbSpec=kQty;
				}
				for(iPitem = 0; iPitem < pitemSize.length; iPitem++){
					$("#selPickProdSpecName_" + pid).val(pvalueSize[iPitem]);
					if(	dbSpec == iPitem){
						if ( parseInt(pinventorySize[iPitem],10) == 0)  //判斷可售數
							$("#selPickProdSpecName_" + pid).after(pitemSize[iPitem] + inventoryText);
						else
							$("#selPickProdSpecName_" + pid).after(pitemSize[iPitem]);
					}else{
						if ( parseInt(pinventorySize[iPitem],10) == 0)  //判斷可售數
							$("#selPickProdSpecName_" + pid).after(pitemSize[iPitem] + inventoryText);
						else
							$("#selPickProdSpecName_" + pid).after(pitemSize[iPitem]);
					}
				}
			}else{
				//判斷可售數
				$("#selPickProdSpecName_" + pid).val(pvalueSize);
				if ( parseInt(pinventorySize,10) == 0 ) //判斷可售數
					$("#selPickProdSpecName_" + pid).after(pitemSize + inventoryText);
				else
				 $("#selPickProdSpecName_" + pid).after(pitemSize);
			}
			ie7Disabled();
		});
		//載入n選m主商品小計
		$("input[id*='editPickProd_']").each(function(){
			var selCount = $(this).attr("selectedIndex");
			var pid = this.id.split("_")[1] + "_" + this.id.split("_")[2];
			var shelfPrice = $("#shelfPrice_" + pid).val();
			var selQty = 0;
			$("#showTotalCount_" + pid).text('￥ '+ parseFloat(shelfPrice).toFixed(1));
			ie7Disabled();
		});

		//載入滿額購商品小計
		$("input[id*='editCampProdName_']").each(function(){
			var pid = this.id.split("_")[1] + "_" + this.id.split("_")[2];
			var shelfPrice = $("#shelfPrice_" + pid).val();
			$("#showTotalCount_" + pid).text('￥ '+ parseFloat(shelfPrice).toFixed(1));
			ie7Disabled();
		});

		//載入主商品spec(type=0)
		
		<%--
		$("input[id*='editMainProdSpecName_']").each(function(){
			var pid = this.id.split("_")[1] + "_" + this.id.split("_")[2];
			var pitem=$(this).val().split(";")[0];
			var pvalue=$(this).val().split(";")[1];
			var pitemSize = pitem.indexOf(",") != -1 ? pitem.split(",") : pitem;
			var pvalueSize = pvalue.indexOf(",") != -1 ? pvalue.split(",") : pvalue;
			var dbSpec = 0;
			//找出第n個數量>0的，就check spec
			var ckQty=	$("#editMainQty_"+pid).val();
			//庫存量(可售數)
			var pinventory = $("#productInventory_"+pid).val();
			var pinventorySize = pinventory.indexOf(",") != -1 ? pinventory.split(",") : pinventory;
			var inventoryText = "-已售完";
			if ( ckQty.indexOf(",") != -1 ){
				ckQty = ckQty.split(",");
				for(kQty = 0; kQty < ckQty.length; kQty++){
					if ( parseInt(ckQty[kQty],10) > 0 )
						dbSpec=kQty;
				}
				for(iPitem = 0; iPitem < pitemSize.length; iPitem++){
					if(	dbSpec == iPitem){
						if ( parseInt(pinventorySize[iPitem],10) == 0 )  //判斷可售數
							$("#selMainProdSpecName_" + pid).append("<option value='" + pvalueSize[iPitem]  + "'  selected='selected' disabled='disabled'>" + pitemSize[iPitem] + inventoryText + "</option>");
						else
							$("#selMainProdSpecName_" + pid).append("<option value='" + pvalueSize[iPitem]  + "'  selected='selected'>" + pitemSize[iPitem] + "</option>");
					}else{
						if ( parseInt(pinventorySize[iPitem],10) == 0 ) //判斷可售數
							$("#selMainProdSpecName_" + pid).append("<option value='" + pvalueSize[iPitem] + "' disabled='disabled'>" + pitemSize[iPitem] + inventoryText + "</option>");
						else
							$("#selMainProdSpecName_" + pid).append("<option value='" + pvalueSize[iPitem] + "'>" + pitemSize[iPitem] + "</option>");
					}
				}
			}else{
				//判斷可售數
				if ( parseInt(pinventorySize,10) == 0 ){ //判斷可售數
					$("#selMainProdSpecName_" + pid).append("<option value='" + pvalueSize + "' selected='selected' disabled='disabled'>" + pitemSize + inventoryText + "</option>");
					$("#selMainProdSpecName_" + pid).append("<option>123</option>");
					}else{
				  $("#selMainProdSpecName_" + pid).append("<option value='" + pvalueSize + "' selected='selected'>" + pitemSize + "</option>");
					$("#selMainProdSpecName_" + pid).append("<option>123</option>");
				}
			}
			ie7Disabled();
		});
		--%>
//Tina update
		
		//載入主商品數量(type=0)
		$("input[id*='editMainMaxCount_']").each(function(){
			var pid = this.id.split("_")[1] + "_" + this.id.split("_")[2];
			var pvalue=$(this).val();
			var pvalueSize = pvalue.indexOf(",") != -1 ? pvalue.split(",")  : pvalue;
			//庫存量(可售數)
			var pinventory = $("#productInventory_"+pid).val();
			var pinventorySize = pinventory.indexOf(",") != -1 ? pinventory.split(",") : pinventory;
			var dbSpec = 0;
			var shelfPrice = $("#shelfPrice_" + pid).val();
			var spcMaxNo = 0;
			var selQty = 0;
			var selInvQty = 0;
			var itemMin=$('#editMainMinCount_'+pid).attr('value');
			itemMin=parseInt(itemMin);
			//找出第n個數量>0的，就check spec
			var ckQty=	$("#editMainQty_"+pid).val();
			if ( ckQty.indexOf(",") != -1 ){
				ckQty = ckQty.split(",");
				for(kQty = 0; kQty < ckQty.length; kQty++){
					if ( parseInt(ckQty[kQty],10) > 0 )
						dbSpec=kQty;
				}
				//選取的屬性最大規格的量
				spcMaxNo = pvalueSize[dbSpec];
				selQty = ckQty[dbSpec];
				//判断如果最大规格的数量大于可售数，就已可售数为主，否则则以最大规格的数量为主
				selInvQty = parseInt(pinventorySize[dbSpec],10);
				if ( spcMaxNo >= selInvQty)
					spcMaxNo = selInvQty;
			}else{
				spcMaxNo = pvalueSize;
				selQty = ckQty;
				//判断如果最大规格的数量大于可售数，就已可售数为主，否则则以最大规格的数量为主
				selInvQty = parseInt(pinventorySize,10);
				if ( spcMaxNo >= selInvQty)
					spcMaxNo = selInvQty;
			}
			
			if (  parseInt(spcMaxNo,10) == 0  || parseInt(pinventorySize,10)<itemMin)
				$("#selMainMaxCount_" + pid).append("<option value='0' selected='selected'>0</option>");

			else{
				
				
				
				for(iPitem = itemMin; iPitem <= spcMaxNo; iPitem++){
						if(	selQty == iPitem)
							$("#selMainMaxCount_" + pid).append("<option value='" + iPitem  + "'  selected='selected'>" + iPitem + "</option>");
						else
							$("#selMainMaxCount_" + pid).append("<option value='" + iPitem + "'>" + iPitem + "</option>");
				}
			}
			$("#showTotalCount_" + pid).text('￥'+(shelfPrice * $("#selMainMaxCount_" + pid).find('option:selected').val()).toFixed(1));
			ie7Disabled();
		});

		//載入加購數量(type=3)
		$("input[id*='editAddMaxCount_']").each(function(){
			
			var pid = this.id.split("_")[1] + "_" + this.id.split("_")[2];
			var pvalue=$(this).val();
			var pvalueSize = pvalue.indexOf(",") != -1 ? pvalue.split(",") :pvalue;
			//庫存量(可售數)
			var pinventory = $("#productInventory_"+pid).val();
			var pinventorySize = pinventory.indexOf(",") != -1 ? pinventory.split(",") : pinventory;

			
			var dbSpec = 0;
			var shelfPrice = $("#shelfPrice_" + pid).val();
			var spcMaxNo = 0;
			var mainProdId = $("#editMainProduct_" + pid).val();
			//抓加購主商品選取的數量
			var mainMaxNo = $("#editMainProduct_" +pid).val();
			var tempMaxNo = 0;
			var tempQty = 0;

			/*
			//找出第n個數量>0的，就check spec
			var ckQty=	$("#editAddQty_"+pid).val();
			if ( ckQty.indexOf(",") != -1 ){
				ckQty = ckQty.split(",");
				for(kQty = 0; kQty < ckQty.length; kQty++){
					if ( parseInt(ckQty[kQty],10) > 0 )
						dbSpec=kQty;
				}
				//選取的屬性最大規格的量(如果主商品的量小於最大規格的量，則以主商品的量為主，若主商品的量大於最大規格的量，則以最大規格的量為主)
				spcMaxNo = pvalueSize[dbSpec];
				//判断如果最大规格的数量大于可售数，就已可售数为主，否则则以最大规格的数量为主
				selInvQty = parseInt(pinventorySize[dbSpec],10);
				if ( parseInt(ckQty[dbSpec],10) > parseInt(selInvQty,10) )
					tempQty = parseInt(selInvQty,10);
				else
					tempQty = parseInt(ckQty[dbSpec],10);
			}else{
				 spcMaxNo = pvalueSize;
				 selInvQty = parseInt(pinventorySize,10);
				 if ( parseInt(spcMaxNo,10) > parseInt(selInvQty,10) )
						tempQty = parseInt(selInvQty,10);
					else
						tempQty = parseInt(spcMaxNo,10);
			}
			*/
			
			tempQty=$('#editAddQty_'+pid).val();

			////if ( parseInt(mainMaxNo,10) == 0 || parseInt(tempQty,10) == 0 )//若庫存量為0的，就直接把下拉式選單改為0
			//	$("#selAddMaxCount_" + pid).append("<option value='0' selected='selected'>0</option>");
			//else{
				//先判斷spc的最大購買數量是否大於主商品的最大購買數量，是的話就將tempMaxNo的最大購買數量設為主商品的購買數量
				//if ( parseInt(spcMaxNo,10) > parseInt(mainMaxNo,10) ) tempMaxNo = mainMaxNo;
				//else tempMaxNo = spcMaxNo;
				//alert(tempQty);
				//再判斷tempMaxNo的最大購買數量是否大於可售數，是的話就將tempMaxNO的最大購買數量設為可售數
				//if ( parseInt(tempMaxNo,10) > parseInt(tempQty,10))
				//	tempMaxNo = parseInt(tempQty);
				tempMaxNo=mainMaxNo;

				
				for(iPitem = 1; iPitem <= tempMaxNo; iPitem++){

					if(	tempQty == iPitem)
						$("#selAddMaxCount_" + pid).append("<option value='" + iPitem  + "' selected='selected'>" + iPitem + "</option>");
					else
						$("#selAddMaxCount_" + pid).append("<option value='" + iPitem + "'>" + iPitem + "</option>");
				}
			//}
			$("#showTotalCount_" + pid).text('￥'+(shelfPrice*parseInt($("#selAddMaxCount_" + pid).find('option:selected').val(),10)).toFixed(1));
			ie7Disabled();
		});		

		/*************************** change 属性or数量 ****************************/
		//change主商品屬性就動態載入該屬性對應的最大的數量	
		$(":input[name='selMainProdSpecName']").change(function(){

			location.href='<c-rt:url value="/shopping/updateCart.do"/>?ss=${ss}&cartOrderProdId='+$(this).attr('id').split('_')[1]+'&prodSpecId='+$(this).attr('value');

		});

		//change主商品的數量就自動change加購的數量
		$(":input[name*='selMainMaxCount']").change(function(){
			
			location.href='<c-rt:url value="/shopping/updateCart.do"/>?ss=${ss}&cartOrderProdId='+$(this).attr('id').split('_')[1]+'&prodQty='+$(this).attr('value');

		});

		//change 加購的數量
		$(":input[name='selAddMaxCount']").change(function(){
			location.href='<c-rt:url value="/shopping/updateCart.do"/>?ss=${ss}&cartOrderProdId='+$(this).attr('id').split('_')[1]+'&addonProdId='+$(this).attr('id').split('_')[2]+'&prodQty='+$(this).attr('value');
		});
		
		$("#dialog").dialog({
			bgiframe: true,
			autoOpen: false,
			height: 150,
			width:350,
			modal: true
		});

		$("#dialog2").dialog({
			bgiframe: true,
			autoOpen: false,
			height: 150,
			width:350,
			modal: true
		});		

		$("#cartdialog").dialog({
			bgiframe: true,
			autoOpen: false,
			height: 150,
			width:350,
			modal: true
		});

		$("#delMainCartDialog").dialog({
			bgiframe: true,
			autoOpen: false,
			height: 150,
			width:350,
			modal: true
		});		

		$("#delSubCartDialog").dialog({
			bgiframe: true,
			autoOpen: false,
			height: 150,
			width:350,
			modal: true
		});

		//赠品数量不足时
		$("#chkPinvyDialog").dialog({
			bgiframe: true,
			autoOpen: false,
			height: 200,
			width:400,
			modal: true
		});	

		//加購滿額購商品
		$("#dialogCampaignProduct").dialog({
			bgiframe: true,
			autoOpen: false,
			height: 110,
			width:650,
			modal: true
		});			
		
		//赠品数量不足时-修改数量
		$("#inv_mod_qty").click(function(){
			location.href="<%=ServerValue.getFrontContextPath()%>/shopping/cart.do?ss=${ss}";
			$("#chkPinvyDialog").dialog('close');
		});	
		//赠品数量不足时-我要继续结帐
		$("#inv_submit").click(function(){
			$("#chkPinvyDialog").dialog('close');
			$("#orderInfoForm").attr('action','orderInfo/orderInfo.do?ss=${ss}').submit();
			return false;
		});	

		$("#d_ok").click(function(){
			$("#dialog").dialog('close');	
			location.href="<%=ServerValue.getFrontContextPath()%>/shopping/cart.do?ss=${ss}";
			return false;	
		});	
		
		$("#cart_ok").click(function(){
			$("#delProdId").val("");//清空删除的商品id
			$("#cartdialog").dialog('close');
			location.href="<%=ServerValue.getFrontContextPath()%>/shopping/cart.do?ss=${ss}";
			return false;
		});		
		
		//刪除主商品(type:0主商品,4活動,5滿額購,6n選m)
		$(":input[id*=delCart_]").click(function(){
			var delCartProdId = $(this).attr('id').split('_')[1];	
			$("#delProdId").val(delCartProdId);
			$("#delMainCartDialog").dialog('open');
			
		});
		//删除主商品(按确定button)
		$("#main_del_ok").click(function(){
			$.getJSON("<%=ServerValue.getFrontContextPath()%>/shopping/delCart.do?ss=${ss}", 
					{cartId:"${cartOrders.cartId}",delCartProdId:$("#delProdId").val()}
				,function(result){
					if(result=='success'){
						$("#cartresult").text('此商品已成功删除！');
					}else{
						$("#cartresult").text('此商品未成功删除！');
					}
					$("#delMainCartDialog").dialog('close');
					//$("#cartdialog").dialog('open');
					$("#delProdId").val("");//清空删除的商品id
					location.href="<%=ServerValue.getFrontContextPath()%>/shopping/cart.do?ss=${ss}";
					return false;
				});	
		});
		//删除主商品(按取消button)
		$("#main_del_cancel").click(function(){
			$("#delProdId").val("");
			$("#delMainCartDialog").dialog('close');
		});
		
		//刪除贈品、加購(type:2贈品,3加購)
		$(":input[id*=delCartDetail_]").click(function(){
			var delCartOrderProdId = $(this).attr('id').split('_')[1];
			var delCartProdId = $(this).attr('id').split('_')[2];
			$("#delProdId").val(delCartProdId);
			$("#delCartOrderProdId").val(delCartOrderProdId);
			$("#delSubCartDialog").dialog('open');
		});

		//删除次商品(按确定button)
		$("#sub_del_ok").click(function(){
			$.getJSON("<%=ServerValue.getFrontContextPath()%>/shopping/delCartDetail.do?ss=${ss}", 
					{cartId:"${cartOrders.cartId}",delCartProdId:$("#delProdId").val(),delCartOrderProdId:$("#delCartOrderProdId").val()}
				,function(result){
					if(result=='success'){
						$("#cartresult").text('此商品已成功删除！');
					}else{
						$("#cartresult").text('此商品未成功删除！');
					}
					$("#delSubCartDialog").dialog('close');
					//$("#cartdialog").dialog('open');
					$("#delProdId").val("");//清空删除的商品id
					location.href="<%=ServerValue.getFrontContextPath()%>/shopping/cart.do?ss=${ss}";
					return false;
				});	
		});
		//删除次商品(按取消button)
		$("#sub_del_cancel").click(function(){
			$("#delProdId").val("");
			$("#delCartOrderProdId").val("");
			$("#delSubCartDialog").dialog('close');
		});		
		
		//滿額購
		/*
		$(":input[id*=addCmpnPrdct_]").click(function(){
			//alert("1:"+isQuotaFilledClicked);
			if(isQuotaFilledClicked)return;
			isQuotaFilledClicked=true;
			var chkCanAddCmpnPrd=parseInt($("#editSumPrice").val(),10);
			if( jQuery('#trCampP').get(0) ) {
				//title, content, callbackFunctionName, width, height, id
				var callbackFunctionName;
				alertDialogById('注意事项','满额购商品限购一件！请先移除购物车里的满额购商品，才可再加入。', callbackFunctionName, 350,180,'alertDialog');
				isQuotaFilledClicked=false;		
			}else{
				if(chkCanAddCmpnPrd>=parseInt("${addPurchaseSetting.basePrice}",10)){
					location.href='<c-rt:url value="/shopping/cart.do"/>?cmpUuid='+$(this).attr('id').split('_')[1];
					
				}else{
					var callbackFunctionName;
					alertDialogById('注意事项','很抱歉，订单必须达' + parseInt("${addPurchaseSetting.basePrice}",10) + '元，才可加购满额购商品。',callbackFunctionName, 350,180,'alertDialog');
					isQuotaFilledClicked=false;		
				}
			}
			//alert("2:"+isQuotaFilledClicked);
		});
		*/
		
		//满额购dialog
		$(":input[id*=addCmpnPrdct_]").click(function(){
			addCampaignProduct($(this).attr("id"));
		});
		$("a[id*=addCmpnPrdct]").click(function(){
			addCampaignProduct($(this).attr("id"));
		});
		
		//商品重量計算
		$("#showweight").click(function(){
			if ( parseInt($("#productCount").text(),10) > 0 ){
				updtCart("");
			}else openWeightDialog();
		});
		
		//結帳
		$("#goNext").click(function(){
			if ( parseInt($("#productCount").text(),10) > 0 ){
				if ( isLogin() ){
					$.post("/ecmall/shopping/checkTlpCart.do?ss=${ss}",{
					 	rs:'cart'},
							function callback(tlpResult){	
								if(tlpResult == '2'){	
									srcParam = "goNext";
									updtCart('goNext');
								}else if(tlpResult == '1' || tlpResult == '3'){	
									content='<div class="alert-caution"><p>每档限时秒杀活动，<b class="txt-rd">同一帐号限购一项商品。</b><br>您可参加下一档秒杀活动喔，谢谢您！</p><div align="center"><a href="javascript:closeDialog();" class="btn-mid">关闭</a></div></div>';
									openDialog('活动信息', content,370,'auto');	
								}else if(tlpResult == '0'){
									$.post("/ecmall/nonMember/checkLogin.do?ss=${ss}",{},nonMemberTimeLimitCartCallback,"json");
								}
							},"json");
					}else{
						window.location.replace("<%=ServerValue.getFrontContextPath()%>/tologin.do?ss=${ss}&redirect_url=http%3A%2F%2F<%=request.getServerName()%><%=ServerValue.getFrontContextPath()%>/shopping/cart.do?addCmpPd=" + $('#addCmpPd').val());
					}
			}else alert("请先订购商品");
		});	

		//繼續選購
		$("#goContinue").click(function(){
			if ( parseInt($("#productCount").text(),10) > 0 ){
				updtCart('goContinue');
			}else{
				if ( "" == "${fromProduct}" && "" == "${fromCategory}")
					window.location.replace("<%=ServerValue.getFrontContextPath()%>/");
				else if ( "" != "${fromProduct}" )
				 	window.location.replace("<%=ServerValue.getFrontContextPath()%>/category/category.do?z=${fromProduct}");
				else if ( "" != "${fromCategory}" )
				 	window.location.replace("<%=ServerValue.getFrontContextPath()%>/category/category.do?z=${fromCategory}");
				return false;
			}
		});	

		//计算总金额
		finalCountSum();

		$(":input[id*=addWishList]").click(function(){
			delCartProdId = $(this).attr("id").split('_')[3];
			productId = $(this).attr("id").split('_')[1];
			price = $(this).attr("id").split('_')[2];
			$.post("<%=ServerValue.getFrontContextPath()%>/checkLogin.do?ss=${ss}",{pathparam:'<%=ServerValue.getFrontHostname()%>'+window.location.pathname+"?productId="+productId+"&price="+price},callback,"json");
			function callback(result){
				if(result=='login'){
					saveWishProduct(productId,price,delCartProdId);
				}else{
					window.location.replace("<%=ServerValue.getFrontContextPath()%>/tologin.do?ss=${ss}&redirect_url="+result);
					return false; 
				}
			}
		});		

		if ($.browser.msie && parseFloat($.browser.version) == 7) {
	        $("select").find("[disabled]").addClass("disabled").removeAttr("disabled");
	        $("select").change(function(){
	            var selected = $(this).val();
	            var disabled = $(this).find("[value="+selected+"]").hasClass("disabled");
	            if (disabled) {
	                alert("This option is disabled.\nSelect will be set to the first option.");
	                $(this).find("option:first").attr("selected","selected");
	            }
	        });
	    }

		 <s:if test="hasActionMessages()">  
			<s:iterator value="actionMessages">  
				var errMsg = "<s:property escape="false"/>";
				var content;
				if ( errMsg == "0"){
					$.post("/ecmall/nonMember/checkLogin.do?ss=${ss}",{},nonMemberTimeLimitCartCallback,"json");
				}
				if ( errMsg == "1" || errMsg == "3" ){
					content='<div class="alert-caution"><p>每档限时秒杀活动，<b class="txt-rd">同一帐号限购一项商品。</b><br>您可参加下一档秒杀活动喔，谢谢您！</p><div align="center"><a href="javascript:closeDialog();" class="btn-mid">关闭</a></div></div>';
					openDialog('活动信息', content,370,'auto');	
				}
		  </s:iterator>  
		 </s:if> 
		$('#presentNotEnough').click(function(){
			location.href='/ecmall/shopping/forceReloadCart.do?ss=${ss}';
			return false;
		});
		$('#mainProdNotEnough').click(function(){
			location.href='/ecmall/shopping/forceReloadCart.do?ss=${ss}';
			return false;
		});
		$('img', $('#recContent_100')).each(function(){
			$(this).attr('src', $(this).attr('original'));
		});	
		$("div[id*='btn-pre']").click(function(){
			var thisid = $(this).attr("id");
			var tmp100 = "";
			if ( thisid.indexOf("_100") == -1 ){
				tmp100 = "";
			}else{
				tmp100 = "_100";
			}
			$('img', $('#recContent' + tmp100)).each(function(){
				$(this).attr('src', $(this).attr('original'));
			});
		});
		$("div[id*='btn-next']").click(function(){
			var thisid = $(this).attr("id");
			var tmp100 = "";
			if ( thisid.indexOf("_100") == -1 ){
				tmp100 = "";
			}else{
				tmp100 = "_100";
			}
			$('img', $('#recContent' + tmp100)).each(function(){
				$(this).attr('src', $(this).attr('original'));
			});
		});
			
		if ( $("#currPage").text() == 1 || $("#currPage_100").text() == 1){
			$(".a-togo").hide();
		}
		$(".a-togo").click(function(){
			var thisid = $(this).attr("id");
			var tmp100 = "";
			if ( thisid.indexOf("_100") == -1 ){
				tmp100 = "";
				$("#page1").show();
				$("#page2").hide();
				$("#page3").hide();
			}else{
				tmp100 = "_100";
				$("#page_1001").show();
				$("#page_1002").hide();
				$("#page_1003").hide();
			}
			$("#currPage" + tmp100).text(1);
			$("#a-togo" + tmp100).hide();
		});
		
		$(".btn-left").click(function(){
			var thisid = $(this).attr("id");
			var tmp100 = "";
			if ( thisid.indexOf("_100") == -1 ){
				tmp100 = "";
			}else{
				tmp100 = "_100";
			}
			var currPage = parseInt($("#currPage" + tmp100).text(),10);
			var totalPage = parseInt($("#totalPage" + tmp100).text(),10);
			if ( (currPage - 1) < 1 ){
				$("#currPage" + tmp100).text(totalPage);
				$("#page"  + tmp100 + currPage).hide();
				$("#page"  + tmp100 + totalPage).show();
			}else{
				$("#currPage" + tmp100).text(currPage-1);
				$("#page" + tmp100 + currPage).hide();
				$("#page" + tmp100 + (currPage-1)).show();
			}
			if ( $("#currPage" + tmp100 ).text() == 1 ){
				$("#a-togo" + tmp100).hide();
			}else{
				$("#a-togo" + tmp100).show();
			}
		});
		$(".btn-right").click(function(){
			var thisid = $(this).attr("id");
			var tmp100 = "";
			if ( thisid.indexOf("_100") == -1 ){
				tmp100 = "";
			}else{
				tmp100 = "_100";
			}
			var currPage = parseInt($("#currPage" + tmp100).text(),10);
			var totalPage = parseInt($("#totalPage" + tmp100).text(),10);
			if ( (currPage + 1) > totalPage){
				$("#currPage" + tmp100).text(1);
				$("#page"  + tmp100 + currPage).hide();
				$("#page" + tmp100 + "1").show();
			}else{
				$("#currPage" + tmp100 ).text(currPage+1);
				$("#page"  + tmp100 + currPage).hide();
				$("#page"  + tmp100 + (currPage+1)).show();
			}
			if ( $("#currPage" + tmp100 ).text() == 1 ){
				$("#a-togo" + tmp100).hide();
			}else{
				$("#a-togo" + tmp100).show();
			}
		});			
	});

	function addCampaignProduct(obj){
		var chkCanAddCmpnPrd=parseInt($("#editSumPrice").val(),10);
		if( jQuery('#trCampP').get(0) ) {
			//title, content, callbackFunctionName, width, height, id
			var callbackFunctionName;
			alertDialogById('注意事项','满额购商品限购一件！请先移除购物车里的满额购商品，才可再加入。', callbackFunctionName, 350,180,'alertDialog');
		}else if(chkCanAddCmpnPrd < parseInt("${addPurchaseSetting.basePrice}",10)){
			var callbackFunctionName;
			alertDialogById('注意事项','很抱歉，订单必须达' + parseInt("${addPurchaseSetting.basePrice}",10) + '元，才可加购满额购商品。',callbackFunctionName, 350,180,'alertDialog');
		}else{
			var addCmpnPrdctId = obj.split('_')[1];	
			openCampaignProductDialog(addCmpnPrdctId);
		}
	}
	
	function nonMemberTimeLimitCartCallback(result){//非會員點限時搶購商品加入購物車
		if(result.split('#')[0]=='needToActivate' || result.split('#')[0]=='waitActivate'){
				content='<div class="alert-caution"><p><b class="txt-rd">限时秒杀仅限会员购买！</b><br>立即<a href="/ecmall/toreg.do">加入会员</a>您可马上享受优惠！</p><div align="center"><a href="javascript:showNonmemberDialog(\'' + result + '\');closeDialog();" class="btn-mid" onfocus="blur()">登录或注册</a><a href="javascript:closeDialog();" class="btn-mid">关闭</a></div></div>';
				openDialog('活动信息', content,360,230);
		}
	}
	
	//open 重量计算详情視窗
	function openWeightDialog(){
		openDialogById("重量计算详情",$("#showWeightDialog").load("<%=ServerValue.getFrontContextPath()%>/shopping/showWeight.do?ss=${ss}"),600,500, 'dialogWeight');
	}

	//open 滿額購視窗
	function openCampaignProductDialog(cmpnPrdctId){
		var ss = Math.ceil(Math.random()*999999999999999); 
		openDialogById("满额购",$("#showCampaignProductDialog").load("<%=ServerValue.getFrontContextPath()%>/shopping/showCampaignProduct.do?ss=${ss}&cmpnPrdctId=" + cmpnPrdctId),650,480, 'campaignProductDialog');
	}
	//更新购物车
	function updtCart(src){
		var updateCartData="";		
		//N选M商品(type=6)
		$("input[id*='editPickProdSpecName_']").each(function(){
			var pid = this.id.split("_")[1] + "_" + this.id.split("_")[2];
			updateCartData=updateCartData + this.id.split("_")[1];//cartOrderProdId
			updateCartData=updateCartData+",";
			updateCartData=updateCartData + $("#selPickProdSpecName_" + pid).val();//prodSpecId
			updateCartData=updateCartData+",";
			updateCartData=updateCartData+"1";//qty
			updateCartData=updateCartData+",";
			updateCartData=updateCartData+this.id.split("_")[2];//prodId
			updateCartData=updateCartData+";";
		});
		//主商品(type=0)
		$("input[id*='editMainProdSpecName_']").each(function(){
			var pid = this.id.split("_")[1] + "_" + this.id.split("_")[2];
			updateCartData=updateCartData + this.id.split("_")[1];//cartOrderProdId
			updateCartData=updateCartData+",";
			updateCartData=updateCartData + $("#selMainProdSpecName_" + pid).val();//prodSpecId
			updateCartData=updateCartData+",";
			updateCartData=updateCartData+$("#selMainMaxCount_" + pid).find('option:selected').val();
			updateCartData=updateCartData+",";
			updateCartData=updateCartData+this.id.split("_")[2];
			updateCartData=updateCartData+";";
		});
		//加购(type=3)
		$("input[id*='editAddSpecId_']").each(function(){
			var pid = this.id.split("_")[1] + "_" + this.id.split("_")[2];
			updateCartData=updateCartData + this.id.split("_")[1];//cartOrderProdId
			updateCartData=updateCartData+",";
			updateCartData=updateCartData + $(this).val();//prodSpecId
			updateCartData=updateCartData+",";
			updateCartData=updateCartData+$("#selAddMaxCount_" + pid).find('option:selected').val();
			updateCartData=updateCartData+",";
			updateCartData=updateCartData+this.id.split("_")[2];
			updateCartData=updateCartData+";";
		});
		//赠品(type=2)
		$("li[id*='present_']").each(function(){
			var pid = this.id.split("_")[1] + "_" + this.id.split("_")[2];
			//alert($("#selPresentProdSpecName_" + pid).val());
			//alert($(this).text());
			updateCartData=updateCartData + this.id.split("_")[1];//cartOrderProdId
			updateCartData=updateCartData+",";
			updateCartData=updateCartData + $("#selPresentProdSpecName_" + pid).val();//prodSpecId
			updateCartData=updateCartData+",";
			updateCartData=updateCartData+parseInt($(this).text(),10);
			updateCartData=updateCartData+",";
			updateCartData=updateCartData+this.id.split("_")[2];
			updateCartData=updateCartData+";";
		});		
		//主商品(满额购)
		var addCmpPd="";
		if($("#cmpPordId").val()!=null){
			addCmpPd=addCmpPd+$("#cmpPordId").val();
			addCmpPd=addCmpPd+",";
			addCmpPd=addCmpPd+$("#campProdSpecName").val();
		}
		
		$("#addCmpPd").val(addCmpPd);
		$.getJSON("<%=ServerValue.getFrontContextPath()%>/shopping/goOrderInfo.do?ss=${ss}",{updateCartData:updateCartData,addCmpPd:addCmpPd}
		,function(result){			
			if(result=='success'){
				if(src=='goContinue'){
					if ( "" == "${fromProduct}" && "" == "${fromCategory}")
						window.location.replace("<%=ServerValue.getFrontContextPath()%>/");
					else if ( "" != "${fromProduct}" )
					 	window.location.replace("<%=ServerValue.getFrontContextPath()%>/category/category.do?ss=${ss}&z=${fromProduct}");
					else if ( "" != "${fromCategory}" )
					 	window.location.replace("<%=ServerValue.getFrontContextPath()%>/category/category.do?ss=${ss}&z=${fromCategory}");
					return false;
				}else{
					$.getJSON("<%=ServerValue.getFrontContextPath()%>/shopping/checkSpecInventory.do?ss=${ss}",{checkFlag:'STEP1M',addCmpPd:addCmpPd,rsPage:'cart'}
					,function(result){	
						if(result!='OK'){// 主商品數量檢查
							//alertDialog("库存不足",result,"",400,200);
							if(result.indexOf('赠品 ')>0){
								$("#chkPinvyDialog > p").eq(0).html(result);
								$('#chkPinvyDialog').dialog('destroy');
								$('#chkPinvyDialog').dialog({
									bgiframe: true,
									width:380,
									modal: true
								});
							}else{
								//alert(result);
								$("#chkProdInvDialog > p").eq(0).html(result);
								$('#chkProdInvDialog').dialog('destroy');
								$('#chkProdInvDialog').dialog({
									bgiframe: true,
									width:380,
									modal: true

									});
								//alertDialog("库存不足",result,"",400,200);
							}
						}else{
							if(src=='goNext'){
								$("#orderInfoForm").attr('action','orderInfo/orderInfo.do?ss=${ss}').submit();
								return true;
							}else if(src=='orderInfo'){
								window.location.replace("<%=ServerValue.getFrontContextPath()%>/tologin.do?ss=${ss}&redirect_url=http%3A%2F%2F<%=request.getServerName()%><%=ServerValue.getFrontContextPath()%>/shopping/cart.do?addCmpPd=" + $('#addCmpPd').val());
							return false;
							}else openWeightDialog();
						}
						<%--
						}else{
								if(src=='goNext'){
									$.getJSON("<%=ServerValue.getFrontContextPath()%>/shopping/checkSpecInventory.do",{checkFlag:'STEP1P'}
									,function(result){	
										if(result!='OK'){// 赠品數量檢查
											$("#chkPinvyDialog > div#resultDiv").html(result);
											$("#chkPinvyDialog").dialog('open');
										}else{
											$("#orderInfoForm").submit();
											return true;
										}
									});
								}else if(src =='orderInfo'){
									<c-rt:if test="${fn:endsWith(hostName, 'yaodian100.com')}">
										if ( hasTlProduct == "true" )
											loginTimeLimitDialog('你还没有登入', '你还没有登入耀点100！<br><b class="txt-rd">限时秒杀仅会员独享优惠！</b>', 'loginForwardRedirect()',360,230);
										else
											loginPromptDialog('你还没有登入', '你还没有登入耀点100!', 'loginForwardRedirect()','notMemberloginForwardRedirect()',360,220);
									</c-rt:if>
									<c-rt:if test="${!fn:endsWith(hostName, 'yaodian100.com')}">
									window.location.replace("<%=ServerValue.getFrontContextPath()%>/tologin.do?redirect_url=http%3A%2F%2F<%=request.getServerName()%><%=ServerValue.getFrontContextPath()%>/shopping/cart.do?addCmpPd=" + $('#addCmpPd').val());
									</c-rt:if>
									return false;
								}else openWeightDialog();
							
						}
						--%>
					});
				}	
			}else{
				alert('購物車更新失敗');
			}
		});		
	}	

	function loginForwardRedirect(){
		window.location.replace("<%=ServerValue.getFrontContextPath()%>/tologin.do?ss=${ss}&redirect_url=<%=ServerValue.getFrontHostname()%><%=ServerValue.getFrontContextPath()%>/shopping/cart.do?addCmpPd=" + $('#addCmpPd').val());
	}
	function notMemberloginForwardRedirect(){
		window.location.replace("<%=ServerValue.getFrontContextPath()%>/nonMember/login.do?ss=${ss}&redirect_url=<%=ServerValue.getFrontHostname()%><%=ServerValue.getFrontContextPath()%>/shopping/orderInfo/orderInfo.do?orderTotalPrice=" + $('#orderTotalPrice').val());
	}

	//去除字串左邊的空白虛格
	function ltrim(instr){
	return instr.replace(/^[\s]*/gi,"");
	}

	//去除字串右邊的空白虛格
	function rtrim(instr){
	return instr.replace(/[\s]*$/gi,"");
	}

	//去除字串前後的空白虛格
	function trim(instr){
	instr = ltrim(instr);
	instr = rtrim(instr);
	return instr;
	}


	
	//重新加总金额
	function finalCountSum(){
		var sumPrice = 0;
		$("div[id*='showTotalCount_']").each(function(){
			//alert($(this).attr('id')+":\'"+$(this).text())+'\'';
			if(trim($(this).text())!='' && trim($(this).text())!='--'){
				sumPrice = sumPrice + parseFloat($(this).text().replace("￥",""));
			}
		});
		$('#hiddenSumPrice').attr('value', sumPrice.toFixed(1));
		$('#orderTotalPrice').attr('value', ($('#hiddenSumPrice').attr('value')-0).toFixed(1));

		var orderTotalDiscount=$('#orderTotalDiscount').attr('value');
		if(isNaN(orderTotalDiscount))orderTotalDiscount=0.0;
		
		var orderSumPrice=$('#hiddenSumPrice').attr('value')-orderTotalDiscount;
		if(orderSumPrice<0)orderSumPrice=0;
		$("#editSumPrice").val((orderSumPrice).toFixed(1));
		if ( null != $("#cmpPordId").val()){
			if ( parseInt($("#editSumPrice").attr('value'),10) < parseInt("${addPurchaseSetting.basePrice}",10) ){
				funDelCamp();
			}
		}
		
		finalCountWeight();
	}
	//加入收藏 
	function addWishList(obj){
			delCartProdId = obj.split('_')[3];
			productId = obj.split('_')[1];
			price = obj.split('_')[2];
			$.post("<%=ServerValue.getFrontContextPath()%>/checkLogin.do?ss=${ss}",{pathparam:'<%=ServerValue.getFrontHostname()%>'+window.location.pathname+"?productId="+productId+"&price="+price},callback,"json");
			function callback(result){
				if(result=='login'){
					saveWishProduct(productId,price,delCartProdId);
				}else{
					window.location.replace("<%=ServerValue.getFrontContextPath()%>/tologin.do?ss=${ss}&redirect_url="+result);
					return false; 
				}
			}		
	}
	function saveWishProduct(productId, productPrice,delCartProdId){
		if(delCartProdId!="camp"){
			$.post("<%=ServerValue.getFrontContextPath()%>/shopping/delCart.do?ss=${ss}",{cartId:"${cartOrders.cartId}",delCartProdId:delCartProdId},callback,"json");	
		}	
		$.post("<%=ServerValue.getFrontContextPath()%>/member/myCollection/saveWishList.do?ss=${ss}",{productId:productId,productPrice:productPrice},callback,"json");
		function callback(result){
			if(result=='success'){
				$("#result").text('此商品已移入收藏盒！');				
			}else{
				$("#result").text('此商品已移入收藏盒！');
			}
			$("#dialog2").dialog('open');
		}
	}
	
	//刪除滿額購商品
	function funDelCamp(){
		$("#tCampP").html("");
		$("#productCount").text(parseInt($("#productCount").text(),10) -1);
		$("#cartSum").text(parseInt($("#cartSum").text(),10) -1);
		finalCountSum();
	}

	//重新計算重量
	function finalCountWeight(){
		var totalWeight = 0;
		$(":input[id*='productWeight_']").each(function(){
			
			var pid = this.id.split("_")[1] + "_" + this.id.split("_")[2];
			var pType = this.id.split("_")[3];
			
			if ( parseInt($(this).val(),10) > 0 ){
				//n選m商品(type=6),滿額購商品(type=5)
				if ( pType== "6" || pType == "5" )
					totalWeight = parseFloat(totalWeight + ($(this).val()/1000));
				//主商品(type=0)
				if ( pType == "0")
					totalWeight = parseFloat(totalWeight + ($(this).val()/1000 * $("#selMainMaxCount_" + pid).find('option:selected').val()));
				//加購(type=3)
				if ( pType == "3")
					totalWeight = parseFloat(totalWeight + ($(this).val()/1000 * $("#selAddMaxCount_" + pid).find('option:selected').val()));
				//贈品(type=2)
				if ( pType == "2")
					totalWeight = parseFloat(totalWeight + ($(this).val()/1000 * parseInt($("#present_" + pid).text(),10)));
				
			}
		});
		$("#totalWeight").text(totalWeight.toFixed(3));
	}

	function ie7Disabled(){
		if ($.browser.msie && parseFloat($.browser.version) == 7) {
					$("option:disabled").css('color', 'graytext');
	        $("select").find("[disabled]").addClass("disabled").removeAttr("disabled");
	        $("select").change(function(){
	            var selected = $(this).val();
	            var disabled = $(this).find("[value="+selected+"]").hasClass("disabled");
	            if (disabled) {
		            	alertDialog("","此属性已售完,无法选择");
	                $(this).find("option:first").attr("selected","selected");
	            }
	        });
	    }
	}
	$("#presentCloseBtn").click(function(){	
		closeDialog('dialogQuotaFilled');
		return false;
	});
	${pu:reqSet('copDiscount', '0')}

	function addCampaignProductSpec(uuid,specId){
		var isQuotaFilledClicked=false;
		if(isQuotaFilledClicked)return;
		isQuotaFilledClicked=true;
		var chkCanAddCmpnPrd=parseInt($("#editSumPrice").val(),10);
		if(chkCanAddCmpnPrd>=parseInt("${addPurchaseSetting.basePrice}",10)){
			location.href='<c-rt:url value="/shopping/cart.do"/>?ss=${ss}&cmpUuid='+uuid + '&cmpSpecId=' + specId;
		}
	}
--></script>
<s:form action="orderInfo/orderInfo.do" method="post" id="orderInfoForm">
	<div id="container">
	<div class="order-step">
		<img src="/images/orderstep_1.gif" alt="订购步骤1_确认订单名细" /></div>
	<!-- 切換tab -->
	<div class="od-tab-show">
	<div class="a-function"><a class="icon-collection a-blue"
		href="<%=ServerValue.getFrontContextPath()%>/member/myCollection/toproductc.do?ss=${ss}">查看我的收藏盒</a>
	</div>
	<div class="content mb-od">
	<p class="no-portage">
	${campaignDiscount.shoppingHtml}
	</p>
	<h2>购物车<span class="txt-ss">&nbsp;&nbsp;共<span id="cartSum">${cartOrders.productSum}</span>笔</span><c-rt:if test="${!empty cartMessage}">&nbsp;&nbsp;&nbsp;<span class="txt-rd">${cartMessage }</span></c-rt:if></h2>
	</div>
	<table class="tb-2">
		<thead>
			<tr>
				<th width="60">图片</th>
				<th width="290">商品名称</th>
				<th width="50">类型</th>
				<th width="110">属性</th>
				<th width="65">单价</th>
				<th width="65">数量</th>
				<th width="65">小计</th>
				<th width="90">操作</th>
			</tr>
		</thead>
		<tbody id="adcmprd">
			${pu:reqSet('carts', '') }
			${pu:reqSet('rcat', '') }
			<c-rt:forEach items="${cartOrders.cartOrderProducts}" var="theOp" varStatus="rows_index">
			<%--宇汇推薦引擎用 0||6||7--%>
			<c-rt:if test="${theOp.prodTp=='0' || theOp.prodTp=='6' || theOp.prodTp=='7'}">
				<c-rt:set var="carts" scope="request">
				${carts }${empty carts?'':',' }${theOp.prodId },${theOp.unitPrice },${theOp.qty }
				</c-rt:set>
				<c-rt:set var="rcat" scope="request">
				${rcat }${empty rcat?'':',' }${pu:getCategoryId(theOp.categoryPath,'/') }
				</c-rt:set>
			</c-rt:if>
       	<!-- 主商品、活動、滿額購、n選m的主商品 -->
       	<c-rt:choose>
       	<c-rt:when test="${theOp.prodTp=='2'}">
       	
       	<c-rt:forEach items="${theOp.details}" var="viewCartItem" varStatus="rows_index">
			${pu:reqSet('product', pu:get('com.yaodian100.ec.product.entity.Product', viewCartItem.prodId)) }
			${pu:reqSet('tpp', pu:pageableTag('tp', 1, 1)) }
			${pu:reqSet('hql', 'from SpecificationInventory where specId=?') }
			${pu:reqSet('specInventoryParams', null) }
			${pu:listAdd('specInventoryParams', pu:toLong(viewCartItem.prodSpecId)) }

			${pu:reqSet('specInventory', pu:queryByHql(hql, pu:arrayGet('specInventoryParams'), tp)[0]) }
				<c-rt:set var="pId">${viewCartItem.prodId}</c-rt:set>
				<input type="hidden" id="productWeight_${viewCartItem.cartOrderProdId}_${pId}_${viewCartItem.detailTp}" name="productWeight" value="${product.productWeight}"/>
				<input type="hidden" id="productInventory_${viewCartItem.cartOrderProdId}_${pId}" name="productInventory" value="${specInventory.inventory}"/>
       	 <tr> 
	          <td>
          		<img onError="this.src='/PImg/40x40.gif'" src="${product.activateSpecMajors[0].imgIcon}" width="40" height="40"/>
	          </td> 
	          <td><p>${viewCartItem.prodName}</p>
	          	<c-rt:if test="${not empty prodVolumeMap and not empty prodVolumeMap[cop.cartOrderProdId]}">
         				<p>配送限定：<span class="txt-rd">大材积</span>(<a target="_blank" href="/help/1_bigsize.html">详情</a>)</p>
         			</c-rt:if>	
	          </td> 
	          <td><span class="type-2">赠品</span>
	          
	          <span style="display:none"  id="present_${viewCartItem.cartOrderProdId}_${pId}">1</span>
	          </td>
	          <td>
         			<input type="hidden" id="editMainProdSpecName_${viewCartItem.cartOrderProdId}_${pId}" name="editProdSpecName" value="${viewCartItem.prodSpecName};${viewCartItem.prodSpecId}" />
							<input type="hidden" id="editMainQty_${viewCartItem.cartOrderProdId}_${pId}" name="editMainQty" value="1"/>
							<input type="hidden" id="selMainProdSpecName_${viewCartItem.cartOrderProdId}_${pId}" name="selMainProdSpecName" value="${viewCartItem.prodSpecId}"/>${viewCartItem.prodSpecName}
	          </td> 
	          <td>
	          	<div class="t-align-R">
		          	￥ <fmt:formatNumber value="0" pattern="######0.0"/>
	          	</div>
	          	<input type="hidden" id="shelfPrice_${viewCartItem.cartOrderProdId}_${pId}" value="0"/>
	          </td> 
	          <td>
	          		 <input type="hidden" id="editMainMinCount_${viewCartItem.cartOrderProdId}_${pId}" name="editMainMinCount" value="1" />
		            <input type="hidden" id="editMainMaxCount_${viewCartItem.cartOrderProdId}_${pId}" name="editMainMaxCount" value="1" />
		            <input type="hidden" id="editRealCount_${viewCartItem.cartOrderProdId}_${pId}" name="editMainMaxCount" value="${viewCartItem.qty }" />
		            <select id="selMainMaxCount_${viewCartItem.cartOrderProdId}_${pId}" name="selMainMaxCount"></select>          
	          </td> 
	          <td>
	         	 <div id="showTotalCount_${viewCartItem.cartOrderProdId}_${pId}" class="t-align-R">0
	          	</div>
	          </td> 
	          <td>
	          	<div class="t-align-R">
	          	</div>
	          </td> 
	        </tr>
	        </c-rt:forEach>
       	</c-rt:when>
       	<c-rt:when test="${theOp.prodTp eq '0' or theOp.prodTp eq '5'}">
       	<c-rt:forEach items="${theOp.details}" var="viewCartItem" varStatus="rows_index">
       	
			${pu:reqSet('product', pu:get('com.yaodian100.ec.product.entity.Product', viewCartItem.prodId)) }
			${pu:reqSet('theSpec', pu:get('com.yaodian100.ec.product.entity.Specification', pu:toLong(viewCartItem.prodSpecId))) }
			${pu:reqSet('tpp', pu:pageableTag('tp', 1, 1)) }
			${pu:reqSet('hql', 'from SpecificationInventory where specId=?') }
			${pu:reqSet('specInventoryParams', null) }
			${pu:listAdd('specInventoryParams', pu:toLong(viewCartItem.prodSpecId)) }
			${pu:reqSet('mainProductQty', theOp.qty) }
			${pu:reqSet('specInventory', pu:queryByHql(hql, pu:arrayGet('specInventoryParams'), tp)[0]) }
				<c-rt:set var="pId">${viewCartItem.prodId}</c-rt:set>
				<span style="display:none"  id="present_${viewCartItem.cartOrderProdId}_${pId}">${viewCartItem.qty}</span>
				<input type="hidden" id="productWeight_${viewCartItem.cartOrderProdId}_${pId}_${viewCartItem.detailTp}" name="productWeight" value="${product.productWeight}"/>
				<input type="hidden" id="productInventory_${viewCartItem.cartOrderProdId}_${pId}" name="productInventory" value="${specInventory.inventory}"/>
	       		
	       		<c-rt:if test="${viewCartItem.detailTp eq '3' || viewCartItem.detailTp eq '2'}">
	       		${pu:reqSet('tdClass', ' class="boder-w" ') }
	       		</c-rt:if>
	       		<c-rt:if test="${viewCartItem.detailTp ne '3' && viewCartItem.detailTp ne '2'}">
	       		${pu:reqSet('tdClass', ' ') }
	       		</c-rt:if>
	        <tr id="${viewCartItem.detailTp eq '5' ? 'trCampP' : ''}"> 
	          <td ${tdClass }>
	          	<c-rt:forEach items="${product.activateSpecMajors}" var="majors">
		          	<c-rt:if test="${fn:indexOf(majors.jsonDetail,viewCartItem.prodSpecId) != -1}">
				         	<c-rt:set var="imgSpecPath"><img onError="this.src='/PImg/40x40.gif'" src="${majors.imgIcon}" width="40" height="40"/></c-rt:set>
		          	</c-rt:if>
		          </c-rt:forEach>
	          <c-rt:choose>
		          <c-rt:when test="${viewCartItem.detailTp eq '0' or (viewCartItem.detailTp eq '5' and product.isDelete ne 'H')}">
		          	<a href="${application.contextPath}/product/product.do?productId=${pId}&z=${theOp.categoryId}" target="_blank">${imgSpecPath}</a>
	          	</c-rt:when>
	          	<c-rt:otherwise>${imgSpecPath}</c-rt:otherwise>
	          </c-rt:choose>
	          </td> 
	          <td ${tdClass }><p>
	          <c-rt:choose>
	          <c-rt:when test="${viewCartItem.detailTp eq '0' or (viewCartItem.detailTp eq '5' and product.isDelete ne 'H')}">
	          <a href="${application.contextPath}/product/product.do?productId=${pId}&z=${theOp.categoryId}" target="_blank">${viewCartItem.prodName}</a>
	          </c-rt:when>
	          <c-rt:otherwise>
	          ${viewCartItem.prodName}
	          </c-rt:otherwise>
	          </c-rt:choose>
	          </p>
	          <c-rt:if test="${product.productType != 6 and product.canUseCod eq 'N'}">
	          	<p>付款限定：<span class="txt-rd">不支持货到付款</span>(<a href="/help/6_deliveryway.html" target="_blank">详情</a>)</p>
	          </c-rt:if>
         		<c-rt:if test="${not empty prodVolumeMap and not empty prodVolumeMap[viewCartItem.prodId]}">
         			<p>配送限定：<span class="txt-rd">大材积</span>(<a target="_blank" href="/help/1_bigsize.html">详情</a>)</p>
         		</c-rt:if>	          
	          <c-rt:if test="${viewCartItem.detailTp ne '3' && viewCartItem.detailTp ne '2'}">
          	<c-rt:if test="${not empty tlpList and fn:indexOf(tlpList,theOp.prodId) ne -1}">
         			<p><span class="type-7">秒杀</span> 限时秒杀限会员购买</p>
         		</c-rt:if>
	          <c-rt:forEach items="${cartOrders.cartOrderProducts}" var="cop" varStatus="status1">
	          	<c-rt:if test="${viewCartItem.cartOrderProdId eq cop.cartOrderProdId}">
	          	${pu:reqSet('hqlCampaign', 'from Campaign c where ? in elements(c.rangeExtList) and c.enable = ? and c.delete = ? and c.startDateTime <= ? and c.endDateTime >= ? and c.type=?')}
	           	${pu:reqSet('paramsCampaign', null) }
	           	${pu:listAdd('paramsCampaign', pu:toString(cop.prodId)) }
	           	${pu:listAdd('paramsCampaign', pu:toBoolean('true')) }
	           	${pu:listAdd('paramsCampaign', pu:toBoolean('false')) }
	           	${pu:listAdd('paramsCampaign', pu:currentDate()) }
	           	${pu:listAdd('paramsCampaign', pu:currentDate()) }
	           	${pu:listAdd('paramsCampaign', 'S01')}
	           	${pu:reqSet('campaigns', pu:queryByHql(hqlCampaign, pu:arrayGet('paramsCampaign'), null)) }
           
           		<c-rt:if test="${campaigns[0].typeExtends[0].campaignTypeExtension > 0}">
	          	<div class="icon-mypoint">赠送购物金：<b>${campaigns[0].campaignAmount }</b></div>
	          	</c-rt:if>
	          	<c-rt:forEach items="${cop.applyCampaign}" var="ac" varStatus="status2">
	          	<p>
	          	<c-rt:if test="${ac.active}">
	          		<span class="type-4">优惠</span>
	          	</c-rt:if>
	          	<c-rt:if test="${!ac.active}">
	          		<span class="type-6">优惠</span>
	          		<c-rt:if test="${ac.campaign.typeExtends[0].minQty-ac.sumQty >= 0}">
	          		（尚差${ac.campaign.typeExtends[0].minQty-ac.sumQty}件）
	          		</c-rt:if><c-rt:if test="${ac.campaign.typeExtends[0].minQty-ac.sumQty < 0}">
	          		<c-rt:set var="tempCampAmount" value="${ac.campaign.typeExtends[0].minOrderAmount-ac.sumAmount}"/>
	          		（尚差<a class="txt-rd" target="_blank" href="${frontendContextPath}/search/search.do?ss=${ss}&searchWithBrief=1&searchWithDescription=1&startDate=&endDate=&fuzzySearch=&z=&searchKeyword=&minPrice=${tempCampAmount}&maxPrice=${tempCampAmount+5}&sortOrderType=0&pageSize=40" onclick="traceVirtualPage('nav-cart-product');">${tempCampAmount}</a>元）
	          		</c-rt:if>
	          	</c-rt:if>
	          	${pu:reqSet('pc', ac.campaign) }
	          	<a class="btn-promo" href="javascript:openCampaign_${status1.index }_${status2.index }();">${ac.campaign.campaignName } </a>
				<script>
				<c-rt:set scope="request" var="campaignDetail">
            	${pu:replaceAll(pc.campaignDetail, '\'', '&#39;')}
            	</c-rt:set>
            	<c-rt:set scope="request" var="campaignDesc">
            	${pu:replaceAll(pc.campaignDesc, '\'', '&#39;')}
            	</c-rt:set>
					function openCampaign_${status1.index }_${status2.index }(){
						<%
						String campaignDetail=(String)request.getAttribute("campaignDetail");
						String campaignDesc=(String)request.getAttribute("campaignDesc");
						campaignDetail=campaignDetail.replaceAll("\r\n", "").replaceAll("\r", "").replaceAll("\n", "");
						campaignDesc=campaignDesc.replaceAll("\r\n", "").replaceAll("\r", "").replaceAll("\n", "");
						request.setAttribute("campaignDetail", campaignDetail);
						request.setAttribute("campaignDesc", campaignDesc);
						%>
						title='活动信息';
						campaignTitle='${pu:replaceAll(pc.campaignName, '\'', '&#39;')}';
						desc= '${campaignDesc}';
						detail='${campaignDetail}';
						startDate= '<fmt-rt:formatDate value="${pc.startDateTime}" pattern="yyyy/MM/dd HH:mm:ss"/>';
						endDate= '<fmt-rt:formatDate value="${pc.endDateTime}" pattern="yyyy/MM/dd HH:mm:ss"/>';
						url= '${pc.campaignUrl}';
						campaignDialogId= 'dialogForEvent';
						width= 300;
						height= 'auto';

						var content=compositeCampaign(campaignTitle, desc, detail, startDate, endDate, url, campaignDialogId);
						openDialogById(title, content,width,height,campaignDialogId);
						$( '#'+campaignDialogId).dialog('option', 'position', 'top' );
					}
				</script>
	          	</p>
	          	</c-rt:forEach>
	          		<c-rt:set var="copDiscount" value="${cop.discount}" scope="request"/>
	          		<c-rt:if test="${!empty totalDiscount}">
	          		<c-rt:set var="totalDiscount" value="${pu:toFloat(totalDiscount)+pu:toFloat(copDiscount)}"/>
	          		</c-rt:if>
	          		<c-rt:if test="${empty totalDiscount}">
	          		<c-rt:set var="totalDiscount" value="${copDiscount}"/>
	          		</c-rt:if>
	          	</c-rt:if>
	          </c-rt:forEach>
	          </c-rt:if>
	          </td> 
	          <td ${tdClass }>
	          		<c-rt:if test="${viewCartItem.detailTp eq '3'}">
	            		<span class="type-3">加购</span>
	            	</c-rt:if>
	            	<c-rt:if test="${viewCartItem.detailTp eq '2'}">
	            	<span class="type-2">赠品</span>
	            	</c-rt:if>
	            	<c-rt:if test="${viewCartItem.detailTp eq '5'}">
	            	<span class="type-5">满额购</span>
	            	</c-rt:if>
	            	</td>
	          <td ${tdClass }>
	          	<c-rt:choose>
	          		<c-rt:when test="${viewCartItem.detailTp eq '2'}">--</c-rt:when>
	          		<c-rt:when test="${viewCartItem.detailTp eq '3'}">${viewCartItem.prodSpecName}</c-rt:when>
	          		<c-rt:when test="${viewCartItem.detailTp eq '5'}">${viewCartItem.prodSpecName}
	          			<input type="hidden" id="editCampProdName_${viewCartItem.cartOrderProdId}_${pId}" name="editCampProdName" value="${viewCartItem.prodSpecName};${viewCartItem.prodSpecId}" />
	          		</c-rt:when>
	          		<c-rt:otherwise>
	          		${pu:reqSet('qtyHql', 'from Specification where productId=? and isDelete=? and specificationId=? ') }
	          		${pu:reqSet('specInvenHql', 'from SpecificationInventory where specification.specificationId=?') }
	          		${pu:reqSet('qtyList', null) }
	          		${pu:listAdd('qtyList', viewCartItem.prodId) }
	          		${pu:listAdd('qtyList', 'N') }
	          		${pu:listAdd('qtyList', viewCartItem.prodSpecId) }
	          		${pu:reqSet('specLists', pu:queryByHql(qtyHql, pu:arrayGet('qtyList'), null))}
	          		${pu:reqSet('theSpec', pu:get('com.yaodian100.ec.product.entity.Specification', pu:toLong(viewCartItem.prodSpecId))) }
	          			<input type="hidden" id="editMainProdSpecName_${viewCartItem.cartOrderProdId}_${pId}" name="editProdSpecName" value="${viewCartItem.prodSpecName};${viewCartItem.prodSpecId}" />
									<input type="hidden" id="editMainQty_${viewCartItem.cartOrderProdId}_${pId}" name="editMainQty" value="${viewCartItem.qty}"/>
									<input type="hidden" id="selMainProdSpecName_${viewCartItem.cartOrderProdId}_${pId}" name="selMainProdSpecName" value="${viewCartItem.prodSpecId}">
									<c-rt:forEach items="${specLists}" var="qtySpec">
										${pu:reqSet('specInvenList', null) }
										${pu:listAdd('specInvenList', viewCartItem.prodSpecId) }
										${pu:reqSet('specInvens', pu:queryByHql(specInvenHql, pu:arrayGet('specInvenList'), null)) }
										<c-rt:forEach items="${specInvens}" var="specInven">
										<c-rt:if test="${specInven.specification.specificationId==qtySpec.specificationId}">
											<c-rt:choose>
												<c-rt:when test="${specInven.inventory>0 && specInven.inventory >= theSpec.minCountPerOrder}">
													${qtySpec.specificationName }
												</c-rt:when>
												<c-rt:otherwise>
													${qtySpec.specificationName } -已售完
												</c-rt:otherwise>
											</c-rt:choose>
										</c-rt:if>
										</c-rt:forEach>
									</c-rt:forEach>
								</c-rt:otherwise>
							</c-rt:choose>
	          </td> 
	          <td ${tdClass }>
	          
	          ${pu:reqSet('shelf', mu:getActiveShelf(theOp.prodId)) }
	          	<div class="t-align-R">
		          	<c-rt:choose>
	          <c-rt:when test="${viewCartItem.detailTp ne '2' && viewCartItem.detailTp ne '3'}">
		          	￥ <fmt:formatNumber value="${viewCartItem.amount}" pattern="######0.0"/>
		          	</c-rt:when>
		          	<c-rt:otherwise>
		          	--
		          	</c-rt:otherwise>
		          	</c-rt:choose>
	          	</div>
	          	<input type="hidden" id="shelfPrice_${viewCartItem.cartOrderProdId}_${pId}" value="${viewCartItem.amount}"/>
	          </td> 
	          <td ${tdClass }>
	         		<c-rt:choose>
	         	<c-rt:when test="${viewCartItem.detailTp eq '2'}">
	         	${viewCartItem.qty}
	         	</c-rt:when>
	          	<c-rt:when test="${viewCartItem.detailTp eq '3'}">
	          	
	          		<input type="hidden" id="editAddSpecId_${viewCartItem.cartOrderProdId}_${pId}" name="editAddSpecId" value="${viewCartItem.prodSpecId }"/>
				          	<input type="hidden" id="editAddQty_${viewCartItem.cartOrderProdId}_${pId}" name="editAddQty" value="${viewCartItem.qty}"/>
		            		<input type="hidden" id="editAddMaxCount_${viewCartItem.cartOrderProdId}_${pId}" name="editAddMaxCount" value="${theSpec.maxCountPerOrder}" />
		            		<input type="hidden" id="editMainProduct_${viewCartItem.cartOrderProdId}_${pId}" name="editMainProduct" value="${mainProductQty}" />
		            		<select id="selAddMaxCount_${viewCartItem.cartOrderProdId}_${pId}" name="selAddMaxCount"></select>
	          	</c-rt:when>
	          	<c-rt:when test="${viewCartItem.detailTp eq '5'}">1</c-rt:when>
	          	<c-rt:otherwise>
	          		<input type="hidden" id="editMainMinCount_${viewCartItem.cartOrderProdId}_${pId}" name="editMainMinCount" value="${theSpec.minCountPerOrder }" />
		            <input type="hidden" id="editMainMaxCount_${viewCartItem.cartOrderProdId}_${pId}" name="editMainMaxCount" value="${theSpec.maxCountPerOrder }" />
		            <input type="hidden" id="editRealCount_${viewCartItem.cartOrderProdId}_${pId}" name="editMainMaxCount" value="${viewCartItem.qty }" />
		            <select id="selMainMaxCount_${viewCartItem.cartOrderProdId}_${pId}" name="selMainMaxCount"></select>	          
		          </c-rt:otherwise>
	          	</c-rt:choose>
	          </td> 
	          <td ${tdClass }>
	         	 <div id="showTotalCount_${viewCartItem.cartOrderProdId}_${pId}" class="t-align-R">
	          	</div>
	          	<c-rt:if test="${viewCartItem.detailTp eq '2'}">
	          		<script>
					$(function(){
						$('#showTotalCount_${viewCartItem.cartOrderProdId}_${pId}').html('--');
					});
	          		</script>
	          	</c-rt:if>
	          	<c-rt:if test="${viewCartItem.detailTp eq '5'}">
	          	
	          	<fmt:formatNumber value="${viewCartItem.amount}" pattern="######0.0" var="campPrice"/>
	          	<script>
							$(function(){
								$('#showTotalCount_${viewCartItem.cartOrderProdId}_${pId}').html("￥ ${campPrice}");
							});
	          		</script>
	          	</c-rt:if>
	          </td> 
	          <td ${tdClass }>
	          	<div class="t-align-R">
	          			<c-rt:choose>
	         	<c-rt:when test="${viewCartItem.detailTp ne '2'}">
	            		<input name="按鈕" type="button" value="收藏" id="addWishList_${pId}_${shelf.shelfPrice}_${viewCartItem.cartOrderProdId}" title="移入收藏盒，以后再买。"/>
	            	
		            <input name="按鈕" type="button" value="刪除" id="delCart_${viewCartItem.cartOrderProdId}"/>
		            
		            </c-rt:when>
		            <c-rt:otherwise>
		            --
		            </c-rt:otherwise>
		            </c-rt:choose>
	          	</div>
	          </td> 
	        </tr>
	        </c-rt:forEach>
        </c-rt:when>
        <%--
        <c-rt:when test="${theOp.prodTp eq '2'}">
        <c-rt:forEach items="${theOp.details}" var="viewCartItem" varStatus="rows_index">
			${pu:reqSet('product', pu:get('com.yaodian100.ec.product.entity.Product', viewCartItem.prodId)) }
			${pu:reqSet('tpp', pu:pageableTag('tp', 1, 1)) }
			${pu:reqSet('hql', 'from SpecificationInventory where specId=?') }
			${pu:reqSet('specInventoryParams', null) }
			${pu:listAdd('specInventoryParams', pu:toLong(viewCartItem.prodSpecId)) }

			${pu:reqSet('specInventory', pu:queryByHql(hql, pu:arrayGet('specInventoryParams'), tp)[0]) }
				<c-rt:set var="pId">${viewCartItem.prodId}</c-rt:set>
				<input type="hidden" id="productWeight_${viewCartItem.cartOrderProdId}_${pId}_${viewCartItem.detailTp}" name="productWeight" value="${product.productWeight}"/>
				<input type="hidden" id="productInventory_${viewCartItem.cartOrderProdId}_${pId}" name="productInventory" value="${specInventory.inventory}"/>
	        <tr> 
            <td class="boder-w">&nbsp;</td> 
            <td class="boder-w">
            	<div class="t-align-L"> 
	              <ul>
	              	<c-rt:forTokens items="${viewCartItem.prodName}" delims="," var="pName">
	                <li>• ${pName}</li> 
	                </c-rt:forTokens>
	              </ul> 
            	</div>
            </td> 
            <td class="boder-w"><ol> 
              <li>&nbsp;</li> 
             	<c-rt:forTokens items="${viewCartItem.prodName}" delims=",">
             		<li>
             			<c-rt:if test="${viewCartItem.detailTp eq '2'}"><span class="type-2">赠品</span></c-rt:if>
             		</li>
              </c-rt:forTokens>
            </ol></td> 
            <td class="boder-w">--</td> 
            <td class="boder-w">--</td> 
            <td class="boder-w">
            	<ul>
	              <c-rt:forTokens items="${viewCartItem.prodName}" delims=",">
	             		<li id="present_${viewCartItem.cartOrderProdId}_${pId}">
	             			<c-rt:if test="${viewCartItem.detailTp eq '2'}">
	             				<fmt:parseNumber var="preQty" value="${viewCartItem.qty}"/>
	             				<fmt:parseNumber var="preInventory" value="${specInventory.inventory}"/>
	             				<c-rt:choose>
	             					<c-rt:when test="${preQty > preInventory }">${preInventory}</c-rt:when>
	             					<c-rt:otherwise>${preQty}</c-rt:otherwise>
	             				</c-rt:choose>
		             				
	             			</c-rt:if>
	             		</li>
	              </c-rt:forTokens>
              </ul>
              <input type="hidden" id="selPresentProdSpecName_${viewCartItem.cartOrderProdId}_${pId}" name="selPresentProdSpecName" value="${viewCartItem.prodSpecId}"/>
            </td> 
            <td class="boder-w"></td> 
            <td class="boder-w"></td> 
          </tr> 
          </c-rt:forEach>
        </c-rt:when> 
        --%> 
        <c-rt:when test="${theOp.prodTp eq '6'}">
        <tr> 
	          <td>
	          	${pu:reqSet('product', pu:get('com.yaodian100.ec.product.entity.Product', theOp.prodId)) }
	         		<c-rt:set var="imgSpecPath"><img onError="this.src='/PImg/40x40.gif'" src="/PImg/${fn:substring(theOp.prodId,0,4)}/${theOp.prodId}/${theOp.prodId}_m50.jpg" width="40" height="40"/></c-rt:set>
	          	<a href="${application.contextPath}/product/product.do?productId=${theOp.prodId}&z=${theOp.categoryId}" target="_blank">${imgSpecPath}</a>
	          </td> 
	          <td><p><a href="${application.contextPath}/product/product.do?productId=${theOp.prodId}&z=${theOp.categoryId}" target="_blank">${theOp.prodName}</a>
	          <c-rt:if test="${not empty tlpList and fn:indexOf(tlpList,theOp.prodId) ne -1}">
         			<p><span class="type-7">秒杀</span> 限时秒杀限会员购买</p>
         		</c-rt:if>	  
	          <c-rt:forEach items="${cartOrders.cartOrderProducts}" var="cop">
	          	<c-rt:if test="${theOp.cartOrderProdId eq cop.cartOrderProdId}">
	          	${pu:reqSet('hqlCampaign', 'from Campaign c where ? in elements(c.rangeExtList) and c.enable = ? and c.delete = ? and c.startDateTime <= ? and c.endDateTime >= ? and c.type=?')}
	           	${pu:reqSet('paramsCampaign', null) }
	           	${pu:listAdd('paramsCampaign', pu:toString(cop.prodId)) }
	           	${pu:listAdd('paramsCampaign', pu:toBoolean('true')) }
	           	${pu:listAdd('paramsCampaign', pu:toBoolean('false')) }
	           	${pu:listAdd('paramsCampaign', pu:currentDate()) }
	           	${pu:listAdd('paramsCampaign', pu:currentDate()) }
	           	${pu:listAdd('paramsCampaign', 'S01')}
	           	${pu:reqSet('campaigns', pu:queryByHql(hqlCampaign, pu:arrayGet('paramsCampaign'), null)) }
           
           		<c-rt:if test="${campaigns[0].typeExtends[0].campaignTypeExtension > 0}">
	          	<div class="icon-mypoint">赠送购物金：<b>${campaigns[0].campaignAmount }</b></div>
	          	</c-rt:if>
	          	<c-rt:if test="${not empty prodVolumeMap and not empty prodVolumeMap[theOp.prodId]}">
         				<p>配送限定：<span class="txt-rd">大材积</span>(<a target="_blank" href="/help/1_bigsize.html">详情</a>)</p>
         			</c-rt:if>	 
	          	<c-rt:forEach items="${cop.applyCampaign}" var="ac">
	          	
	          	<p>
	          	<c-rt:if test="${ac.active}">
	          		<span class="type-4">优惠</span>
	          	</c-rt:if>
	          	<c-rt:if test="${!ac.active}">
	          		<span class="type-6">优惠</span>
	          		<c-rt:if test="${ac.campaign.typeExtends[0].minQty-ac.sumQty >= 0}">
	          		（尚差${ac.campaign.typeExtends[0].minQty-ac.sumQty}件）
	          		</c-rt:if><c-rt:if test="${ac.campaign.typeExtends[0].minQty-ac.sumQty < 0}">
	          			<c-rt:set var="tempCampAmount1" value="${ac.campaign.typeExtends[0].minOrderAmount-ac.sumAmount}"/>
	          		（尚差<a class="txt-rd" target="_blank" href="${frontendContextPath}/search/search.do?ss=${ss}&searchWithBrief=1&searchWithDescription=1&startDate=&endDate=&fuzzySearch=&z=&searchKeyword=&minPrice=${tempCampAmount1}&maxPrice=${tempCampAmount1+5}&sortOrderType=0&pageSize=40" onclick="traceVirtualPage('nav-cart-product');">${tempCampAmount1}</a>元）
	          		</c-rt:if>
	          	</c-rt:if>
	          	${pu:reqSet('pc', ac.campaign) }
	          	<a class="btn-promo" href="javascript:openCampaign('活动信息', compositeCampaign('${pu:replaceAll(pc.campaignName, '\'', '&#39;')}', '${pu:replaceAll(pc.campaignDetail, '\'', '&#39;')}', '${pu:replaceAll(pc.campaignDesc, '\'', '&#39;')}', '<fmt-rt:formatDate value="${pc.startDateTime}" pattern="yyyy/MM/dd HH:mm:ss"/>', '<fmt-rt:formatDate value="${pc.endDateTime}" pattern="yyyy/MM/dd HH:mm:ss"/>', '${pc.campaignUrl}', 'dialogForEvent'), 300, 'auto', 'dialogForEvent');">${ac.campaign.campaignName } </a>
	          	<script>
					function openCampaign(title, content,width,height,dialogId){
						openDialogById(title, content,width,height,dialogId);
						$( '#'+dialogId).dialog('option', 'position', 'top' );
					}
				</script>
	          	</p>
	          	</c-rt:forEach>
	          		
	          		<c-rt:set var="copDiscount" value="${cop.discount}" scope="request"/>
	          		<c-rt:if test="${!empty totalDiscount}">
	          		<c-rt:set var="totalDiscount" value="${pu:toFloat(totalDiscount)+pu:toFloat(copDiscount)}"/>
	          		</c-rt:if>
	          		<c-rt:if test="${empty totalDiscount}">
	          		<c-rt:set var="totalDiscount" value="${copDiscount}"/>
	          		</c-rt:if>
	          	</c-rt:if>
	          </c-rt:forEach>
	          </p>
	          
	          </td> 
	          <td>
          	</td>
	          <td>
	          	--
	          			<input type="hidden" id="editPickProd_${theOp.cartOrderProdId}_${pId}" name="editPickProd" value="" />
	          		
	          </td> 
	          <td>
	          
	          ${pu:reqSet('shelf', mu:getActiveShelf(theOp.prodId)) }
	          	<div class="t-align-R">
		          	
		          	￥ <fmt:formatNumber value="${shelf.shelfPrice}" pattern="######0.0"/>
	          	</div>
	          	<input type="hidden" id="shelfPrice_${theOp.cartOrderProdId}_${pId}" value="${shelf.shelfPrice}"/>
	          </td> 
	          <td>
	         		
	          		<span id="selPickMaxCount_${theOp.cartOrderProdId}_${pId}">1</span>
	          	
	          	
	          </td> 
	          <td>
	         	 <div id="showTotalCount_${theOp.cartOrderProdId}_${pId}" class="t-align-R">
	          	</div>
	          	
	          </td> 
	          <td>
	          	<div class="t-align-R">
	          		
	            		<input name="按鈕" type="button" value="收藏" id="addWishList_${theOp.prodId}_${shelf.shelfPrice}_${theOp.cartOrderProdId}" title="移入收藏盒，以后再买。"/>
	            	
		            <input name="按鈕" type="button" value="刪除" id="delCart_${theOp.cartOrderProdId}"/>
	          	</div>
	          </td> 
	        </tr>
        <c-rt:forEach items="${theOp.details}" var="viewCartItem" varStatus="rows_index">
			${pu:reqSet('product', pu:get('com.yaodian100.ec.product.entity.Product', viewCartItem.prodId)) }
			${pu:reqSet('tpp', pu:pageableTag('tp', 1, 1)) }
			${pu:reqSet('hql', 'from SpecificationInventory where specId=?') }
			${pu:reqSet('specInventoryParams', null) }
			${pu:listAdd('specInventoryParams', pu:toLong(viewCartItem.prodSpecId)) }

			${pu:reqSet('specInventory', pu:queryByHql(hql, pu:arrayGet('specInventoryParams'), tp)[0]) }
				<c-rt:set var="pId">${viewCartItem.prodId}</c-rt:set>
				<input type="hidden" id="productWeight_${viewCartItem.cartOrderProdId}_${pId}_${viewCartItem.detailTp}" name="productWeight" value="${product.productWeight}"/>
				<input type="hidden" id="productInventory_${viewCartItem.cartOrderProdId}_${pId}" name="productInventory" value="${specInventory.inventory}"/>
	         <tr> 
	            <td class="boder-w">
	            <c-rt:forEach items="${product.activateSpecMajors}" var="majors">
		          	<c-rt:if test="${fn:indexOf(majors.jsonDetail,viewCartItem.prodSpecId) != -1}">
				         	<c-rt:set var="imgSpecPath"><img onError="this.src='/PImg/40x40.gif'" src="${majors.imgIcon}" width="40" height="40"/></c-rt:set>
		          	</c-rt:if>
		          </c-rt:forEach>
	            	<a href="javascript:void(0);">${imgSpecPath}</a>
	            	<br/>
	            </td> 
	            <td class="boder-w"><p>${viewCartItem.prodName}</p>
	            	<c-rt:if test="${not empty prodVolumeMap and not empty prodVolumeMap[viewCartItem.prodId]}">
         					<p>配送限定：<span class="txt-rd">大材积</span>(<a target="_blank" href="/help/1_bigsize.html">详情</a>)</p>
	         			</c-rt:if>
	            </td> 
	            <td class="boder-w">
	            	
	            	<c-rt:if test="${viewCartItem.detailTp eq '6'}">
	            		<span class="type-4">活动</span>
	            	</c-rt:if>
	            </td> 
	            <td class="boder-w">
	            	
			          		<input type="hidden" id="editPickProdSpecName_${viewCartItem.cartOrderProdId}_${pId}" name="editPickProdSpecName_${viewCartItem.cartOrderProdId}" value="${viewCartItem.prodSpecName};${viewCartItem.prodSpecId}" />
										<input type="hidden" id="editPickQty_${viewCartItem.cartOrderProdId}_${pId}" name="editPickQty" value="${viewCartItem.qty}"/>
										<input type="hidden" id="selPickProdSpecName_${viewCartItem.cartOrderProdId}_${pId}" name="selPickProdSpecName"/>

	            </td> 
	            <td class="boder-w">
	          ${pu:reqSet('shelf', mu:getActiveShelf(theOp.prodId)) }
	            	<input type="hidden" id="editSubtatal_${viewCartItem.cartOrderProdId}_${pId}" value="${shelf.shelfPrice}" />
		            <c-rt:choose>
				          <c-rt:when test="${viewCartItem.detailTp eq '3'}">
				          	<div id="showCount_${viewCartItem.cartOrderProdId}_${pId}" class="t-align-R">
	            			
		            		￥ <fmt:formatNumber value="${shelf.shelfPrice}" pattern="######0.0"/>
		            	</div>
		            	<input type="hidden" id="shelfPrice_${viewCartItem.cartOrderProdId}_${pId}" value="${shelf.shelfPrice}"/>
		            	</c-rt:when>
		            	<c-rt:otherwise>--</c-rt:otherwise>
		            </c-rt:choose>
	            </td>
	            <td class="boder-w">
	            	
		            	<span id="selPickMaxCount_${viewCartItem.cartOrderProdId}_${pId}">${viewCartItem.qty}</span>
		            
	            </td> 
	            <td class="boder-w">

	            </td> 
	            <td class="boder-w">
	            	<div class="t-align-R">
	            		
	              </div>
	            </td> 
	          </tr> 
	          </c-rt:forEach>
        </c-rt:when>
        </c-rt:choose>
			</c-rt:forEach>
		</tbody>
		<tbody id="tCampP">
		</tbody>
	</table>

	<div class="odlist-ft">
		<p class="odlist-note">
			<span class="total-weight">重量总计：<span id="totalWeight"></span>kg 
			
			(<a href="javascript:;" id="showweight">详情</a>)</span><br />
			<span class="total">商品总额：￥ <input type="text" value="0" id="orderTotalPrice" name="orderTotalPrice" class="show-money txt-bk"> 元</span><br/>
			<span class="total">－折抵优惠：￥ <input type="text" value="0" id="orderTotalDiscount" class="show-money"> 元</span><br/>
			共<span class="txt-rd" id="productCount">${cartOrders.productSum}</span> 项商品，合计金额(不含运费)
			<script>
			
			$(function(){
				
				$('#orderTotalDiscount').attr('value', (${totalDiscount}-0).toFixed(1));
				var eTotalDiscount='${totalDiscount}';
				if(isNaN(eTotalDiscount))eTotalDiscount=0.0;
				var orderSumPrice=$('#hiddenSumPrice').attr('value')-eTotalDiscount;
				if(orderSumPrice<0)orderSumPrice=0.0;
				$('#editSumPrice').attr('value', (orderSumPrice).toFixed(1));
				
			});
			</script>
			<input type="hidden" id="hiddenSumPrice" name="hiddenSumPrice" value=""/>
			<span class="txt-rd">￥<input type="text" id="editSumPrice" name="editSumPrice" value="0.0" class="show-money txt-L" readonly="readonly" size="14">元</span>
		</p>
	</div>
	<p class="listbtn">
		<a id="goNext" href="javascript:;" class="btn-bigw-pay" title="进行结帐">结账<b>&nbsp;</b></a>
		<c-rt:choose>
			<c-rt:when test="${empty fromProduct && empty fromCategory}">
				<c-rt:set var="goContinue">回首页</c-rt:set>
			</c-rt:when>
			<c-rt:otherwise>
				<c-rt:set var="goContinue">回馆首页</c-rt:set>
			</c-rt:otherwise>
		</c-rt:choose>
		<a href="javascript:;" onclick=";return false;" id="goContinue" class="btn-bigw-more" title="${goContinue}">继续选购<b>&nbsp;</b></a>
	</p>
	<c-rt:set var="diffAmount" value="${campaignDiscount.minOrderAmount - cartOrders.amount}"/>
	<c-rt:if test="${cartOrders.productSum > 0 and not empty campaignDiscount and diffAmount > 0 }">
		<p class="cart-tips">
			<span>小贴士</span>您再差<strong><fmt-rt:formatNumber value="${diffAmount}" pattern="######0.0"/>元</strong>就能享有运费优惠，看看有那些商品想买
			（<a class="txt-rd" target="_blank" href="${frontendContextPath}/search/search.do?ss=${ss}&searchWithBrief=1&searchWithDescription=1&startDate=&endDate=&fuzzySearch=&z=&searchKeyword=&minPrice=${diffAmount}&maxPrice=${diffAmount+5}&sortOrderType=0&pageSize=40" onclick="traceVirtualPage('nav-cart-note');">看这里</a>）
		</p>	
	</c-rt:if>
	<c-rt:if test="${'on' eq useBfd and not empty cart100Items}">
		<script type="text/javascript">
   		function prodRecommendCallback(prodRecommendList){
				if ( null != prodRecommendList ){      		
    		  var content ="";
    		  var pc = 7;//每頁筆數
    		  var np = 0;
    		  var sp = 0;
    		  var totalCount = prodRecommendList.length;
    		  if ( parseInt(totalCount,10) <= pc ){
    			  $("#btn-pre_100").attr("class","btn-left-no");
    			  $("#btn-next_100").attr("class","btn-right-no");
    		  }
    		  $("#totalCount_100").text(totalCount);
    		  var totalPage = Math.ceil(parseInt(totalCount,10)/7);
    		  $("#totalPage_100").text(totalPage);
    		  for(var pg = 1; pg <= totalPage; pg++ ){
    			  if ( parseInt(totalPage,10) > 1 ){
    				  if ( parseInt(pg,10) != 1 ){
    					  content = content + '<div class="bg_box" id="page_100' + pg + '" style="display:none;">';
    				  }else{
    			  		content = content + '<div class="bg_box" id="page_100' + pg + '">';
    				  }
    			  }else{
    				  content = content + '<div class="bg_box">';
    			  }
    			  sp = pc * pg - pc;
    			  if ( parseInt((sp + pc),10) > parseInt(totalCount,10) ){
    				  np = sp + (totalCount % pc);
    			  }else{
    				  np = sp + pc;
    			  }
    			  for(var i= sp;i < np;i++) {
    					var item = prodRecommendList[i];
    			    var title = item.productName; 
    			    var url = "${frontendContextPath}/product/product.do?productId=" + item.productId;
    			    var itemid = item.productId;
    			    var price = null == item.viewShelf ? "" : item.viewShelf.shelfPrice.toFixed(1);
    			    content = content + '<div class="alsopd">';
    			    content = content + '<a href="' + url + '&req_id=' + req_id_SC + '" target="_blank">';
    			    content = content + '<img width="100" height="100" title="' + title + '" src="${imgDomain}/PImg/' + itemid.substring(0,4) + '/' + itemid + '/' + itemid + '_m100.jpg" onError="this.src=\'${imgDomain}/PImg/blank_100.gif\'" ></a>';
    			    content = content + '<div class="alsoprice"><strong>￥' + price + '</strong></div>';
    			    content = content + '</div>';
    			  }
    			  content = content + '</div>';
    		  }
    		  if ( "" != content ){
        		$("#cmd-baifendian").show();
    			  $("#alsozone_100").show();
    		  	jQuery("#recContent_100").html(content);
    		  }else{
    			  $("#cmd-baifendian").hide();
    			  $(".alsozone cmd-baifendian").hide();
    		  }
   			}
   		}
     </script>
     <h3 id="cmd-baifendian" class="cmd-baifendian" style="display:none;">喜欢这些商品的顾客还喜欢：
			<div class="alsopager cmd-baifendian">
         <p align="right">共<span id="totalCount_100"></span>笔：<span id="currPage_100">1</span>/<span id="totalPage_100"></span> <a id="a-togo_100" class="a-togo" href="###" style="display:none;">&lt;回第1页&gt;</a></p>
       </div>
			</h3>
		 <div id="alsozone_100" class="alsozone cmd-baifendian" style="display:none;">
			<a title="上一页" id="btn-pre_100" class="btn-left" href="###">&nbsp;</a>
			<div id="recContent_100"></div>
   		<a title="下一页" id="btn-next_100" class="btn-right" href="###">&nbsp;</a>
   		<p><a href="http://www.baifendian.com" target="_blank"><img src="/images/bfd_logo.gif"/></a></p>
     </div>
	</c-rt:if>
	<!-- 滿額加購提帶誘購 -->
	<!-- 加購商品點擊後看到的layer -->
	<c-rt:if test="${not empty addPurchaseSetting.basePrice }">
	<div class="buymore">
	<h3>满额可加购商品<span class="note">(购物满${addPurchaseSetting.basePrice}元，可任选一件加购商品)</span></h3>
	<fmt:formatNumber value="${campaignProductSize / 3}" pattern="0.0" var="rowSize"/>
	<c-rt:forEach items="${campainProductPriceList}" var="campainProductPrice" varStatus="rows_index">
		<fmt:formatNumber value="${rows_index.count / 3}" pattern="0.0" var="iRowSize"/>
		<c-rt:set var="url">
     	<%=ServerValue.getFrontContextPath()%>/product/promoteProductInfo.do?ss=${ss}&productId=${fn:split(campainProductPrice,',')[0]}&promoteUuid=${fn:split(campainProductPrice,',')[4]}
     </c-rt:set>
   		<div class="pd-a ${rows_index.count mod 3 == 1 ? 'c-f' : '' }">
        <div class="f-lt">
        	<a href="javascript:void(0);" onclick=";return false;" id="addCmpnPrdct1_${fn:split(campainProductPrice,',')[4]}">
        	<img onError="this.src='/PImg/blank_75.gif'" src="/PImg/${fn:substring(fn:split(campainProductPrice,',')[0],0,4)}/${fn:split(campainProductPrice,',')[0]}/${fn:split(campainProductPrice,',')[0]}_m75.jpg" alt="" width="75" height="75" />
        	</a>
        </div>
        <div class="f-lt pd-data">
        	<a href="javascript:void(0);" onclick=";return false;" id="addCmpnPrdct2_${fn:split(campainProductPrice,',')[4]}">${fn:substring(fn:split(campainProductPrice,',')[1],0,16)}</a>
          <p>市场价￥<fmt:formatNumber	value="${fn:split(campainProductPrice,',')[2]}" pattern="######0.0" /></p>
					<span class="txt-rd txt-ss">加购价
						<strong>￥<fmt:formatNumber value="${fn:split(campainProductPrice,',')[3]}" pattern="######0.0" /></strong>
					</span>
					<a href="javascript:void(0);" onclick=";return false;" class="f-rt">
						<input type="button" id="addCmpnPrdct_${fn:split(campainProductPrice,',')[4]}" value="加入购物车" class="txt-ss" />
					</a>
				</div>
      </div>
	</c-rt:forEach> 
	<input type="hidden" id="addCmpPd" name="addCmpPd" value="" />
	</div>
	</c-rt:if>
	<!-- 滿額加購提帶誘購 -->
	<div>* 您购物车中的商品信息，我们将为您保存1个月，建議您及时购买。购物车中显示的价格为商品的最新价格。<br />
	* 耀点100保留接受订单与否之权利
	<p>
	</div>
	</div>
	</div>
</s:form>
<input type="hidden" id="delProdId" name="delProdId" value=""/>
<input type="hidden" id="delCartOrderProdId" name="delCartOrderProdId" value=""/>
<div id="showWeightDialog"></div>
<div id="delMainCartDialog" title="删除商品" class="collection-dailog-ok" style="display: none;">
	<p id="result">是否要删除此商品?</p>
	<div align="center">
		<span style="text-align: center;">
			<a href="javascript:;" id="main_del_ok" class="btn-mid">确定</a>
			<a href="javascript:;" id="main_del_cancel" class="btn-mid">取消</a>
			
		</span>
	</div>
</div>
<div id="delSubCartDialog" title="删除商品" class="collection-dailog-ok" style="display: none;">
	<p id="result">是否要删除此商品?</p>
	<div align="center">
		<span style="text-align: center;">
			<a href="javascript:;" id="sub_del_ok" class="btn-mid">确定</a>
			<a href="javascript:;" id="sub_del_cancel" class="btn-mid">取消</a>
		</span>
	</div>
</div>
<div id="dialog2" title="收藏商品" class="collection-dailog-ok" style="display: none;">
	<p id="result">此商品已成功移至「收藏盒」！</p>
	<div align="center">
		<span style="text-align: center;">
			<a href="javascript:;" id="d_ok" class="btn-mid">确定</a>
		</span>
	</div>
</div>
<div id="dialogForEvent"></div>
<div id="dialog" title="" class="" style="display: none;"></div>
<div id="cartdialog" title="删除商品" class="collection-dailog-ok" style="display: none;">
	<p id="cartresult"></p>
	<div align="center">
		<span style="text-align: center;">
			<a href="javascript:;" id="cart_ok" class="btn-mid">确定</a>
		</span>
	</div>
</div>
<div id="dialogWeight"></div>
<div id="dialogQuotaFilled"></div>
<div id="alertDialog"></div>
<div id="chkProdInvDialog" title="商品库存不足"  class="alert-caution" style="display: none;">
	<p id="resultDiv"></p>
	<div align="center">
		<span style="text-align: center;">
			<a href="javascript:;" id="mainProdNotEnough" class="btn-mid">刷新购物车</a>
		</span>
	</div>
</div>
<div id="chkPinvyDialog" title="赠品库存不足"  class="alert-caution" style="display: none;">
	<p id="resultDiv"></p>
	<div align="center">
		<span style="text-align: center;">
			<a href="javascript:;" id="presentNotEnough" class="btn-mid">刷新购物车</a>
			<a href="javascript:;" id="inv_submit" class="btn-mid-13">放弃缺货赠品，继续结帐</a>
		</span>
	</div>
</div>
<div id="presentDiv"></div>
<div id="showCampaignProductDialog"></div>
<div id="campaignProductDialog"></div>
<script type="text/javascript" src="http://s.yaodian100.com/js/rec.js">
	{
		"mid":27,
		"carts":"${carts}",
		"rcat":"${rcat}"
		<c-rt:if test="${!empty mu:memberId()}">
		,
		"uid":"${mu:memberId()}"
		</c-rt:if>
	}
</script>
<c-rt:if test="${'on' eq useBfd and not empty cart100Items}">
	<script type="text/javascript">
	var req_id_SC = "";
	window.bfd_onload = function() {
		var client = new brs.Client("${bfdCode}");
		var p = new brs.PackedRequest();
		${cart100Items}
		client.invoke(p,"cb_recommend");
	}
	function cb_recommend(json) {
		var result_SC = json.recSC;
		var code_SC = result_SC[0];
		req_id_SC = result_SC[1];
		var rec_id_SC = result_SC[2];
		if (code_SC == 0 && Object.prototype.toString.apply(rec_id_SC) === '[object Array]') {
			if ( "" != rec_id_SC ){
				$.post("/ecmall/product/jsonProdRecommend.do?ss=${ss}",{prodRecommends:rec_id_SC},prodRecommendCallback,"json");
		  }
		}
	}	
	</script>
</c-rt:if>